/*
 * Copyright (c) 2017 22420103@QQ.COM 版权所有
 */
package com.lehe.service.impl;

import com.lehe.common.exceptions.LHServiceException;
import com.lehe.common.utils.StringUtil;
import com.lehe.entry.wx.message.ReqEventPushMessage;
import com.lehe.entry.wx.message.RespBaseMessage;
import com.lehe.entry.wx.message.RespEventPushMessage;
import com.lehe.service.IWeChatExecuteService;
import org.springframework.stereotype.Service;

/**
 *  微信公众号订阅事件推送业务处理<br>
 *
 * @author 王丹
 * @FileName SubscribeEventExecuteService.java<br>
 * @Language Java<br>
 * @date 2016-08-18<br>
 */
@Service("subscribeEventExecuteService")
public class SubscribeEventExecuteService implements IWeChatExecuteService<ReqEventPushMessage> {

    @Override
    public RespBaseMessage execute(ReqEventPushMessage reqMessage) throws LHServiceException {
        RespEventPushMessage respMessage = new RespEventPushMessage();
        respMessage.setFromUserName(reqMessage.getToUserName());
        respMessage.setToUserName(reqMessage.getFromUserName());
        respMessage.setCreateTime(reqMessage.getCreateTime());
        respMessage.setMsgType("text");
        respMessage.setFuncFlag("0");
        StringBuilder sb = new StringBuilder();
        sb.append("欢迎关注“快诺迅汇”微信公众号" + StringUtil.emoji(0x1F339) + "\n\n");
        sb.append(StringUtil.emoji(0x2764) + "快诺钢铁交易平台“推荐企业注册享红包”活动正在火热进行——\n");
        sb.append(StringUtil.emoji(0x1F4A1) + "注册请点击http://wap.kwiner.com/regist/comRegist\n");
        sb.append(StringUtil.emoji(0x1F4A1) + "快诺APP下载点击http://wap.kwiner.com/dl\n");
        respMessage.setContent(sb.toString());
        return respMessage;
    }
}
